package inabit.inabitcompiler.lexical;

import inabit.compiler.lexical.TokenClass;

/**The enumeration for all the token classes of the language*/
/**@author Rafael Rocha*/
public enum InabitTokenClass implements TokenClass{
	ID(),
	INT_CTE(),
	REAL_CTE(),
	STRING_CTE(),
	OPEN_BRACKETS("{"),
	CLOSE_BRACKETS("}"),
	OPEN_SQUARE_BRACKETS("["),
	CLOSE_SQUARE_BRACKETS("]"),
	OPEN_PARENTHESIS("("),
	CLOSE_PARENTHESIS(")"),
	IF("if", true),
	THEN("then", true),
	AND("and", true),
	OR("or", true),
	NOT("not", true),
	CONTINUOUS("continuous", true),
	DISCRETE("discrete", true),
	ENUMERATION("enumerated", true),
	RULE_DEF("rules", true),
	EQUAL("="),
	IS("is", true),
	GREATER_OR_EQUAL(">="),
	GREATER_THAN(">"),
	LESS_OR_EQUAL("<="),
	LESS_THAN("<"),
	PLUS("+"),
	MINUS("-"),
	MULT("*"),
	DIV("/"),
	EXP("^"),
	COLON(":"),
	SEMI_COLON(";"),
	COMMA(","),
	EOF(),
	FUZZYSETS("fuzzysets", true), 
	IMPORT("import", true),
	AS("as", true),
	DEFINE("define",true), 
	BELLSHAPED("bellshaped", true), 
	FROM("from", true),
	TO("to", true),
	CONSTANTS("constants", true);
	
	private boolean univoque;//a token class is univoque if it doesn't need a value
	private String idString;//the form that the token appears in the text
	private boolean isReservedWord;//return true if the token is a reserved word
	
	private InabitTokenClass(){
		univoque = false;
		isReservedWord = false;
		this.idString = toString();
	}
	private InabitTokenClass(String idString) {
		
		this.univoque = true;
		this.idString = idString;
		isReservedWord=false;
	}
	private InabitTokenClass(String idString, boolean isReservedWord) {
		
		this.univoque = true;
		this.idString = idString;
		this.isReservedWord=isReservedWord;
	}
	
	/**A token class is univoque if it doesn't need a value to be identified*/
	public boolean isUnivoque() {
		return univoque;
	}
	/**The representation form of the token on text*/
	public String getStateLabel() {
		return this.idString;
	}
	/**Returns <i>true</i> if the token is a reserved word on language*/
	public boolean isReservedWord() {
		return this.isReservedWord;
	}
	public String getID() {
		return this.toString();
	}
}
